WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::SensorDiffDrive Class Reference

Wheel encoders of a differential drive robot. Intrinsics 'I': left and right wheel radius and wheel separation. More...

#include <core/sensor/sensor_diff_drive.h>

Inheritance diagram for wolf::SensorDiffDrive:
[legend]

Public Member Functions

 WOLF_SENSOR_CREATE (SensorDiffDrive)
 
 ~SensorDiffDrive () override=default
 
Eigen::MatrixXd computeNoiseCov (const Eigen::VectorXd &_data) const override
 Computes the covariance of the measurement noise of some data. More...
 
double getTicksPerWheelRevolution () const
 Returns the number of encoder ticks of a whole wheel revolution. More...
 
double getTicksStdFactor () const
 Returns the ratio of the ticks noise std to the measured ticks. More...
 
double getRadiansPerTick () const
 Returns the wheel rotation of an encoder tick [rad]. More...
 
- Public Member Functions inherited from wolf::SensorBase
 ~SensorBase () override
 
unsigned int id () const override
 Returns the id of the node, unique among the nodes of its category. More...
 
HardwareBaseConstPtr getHardware () const
 Returns the hardware the sensor belongs to. More...
 
HardwareBasePtr getHardware ()
 Returns the hardware the sensor belongs to. More...
 
YAML::Node getParams () const
 Returns a copy of the YAML parameters. More...
 
ProcessorBaseConstPtrList getProcessorList () const
 Returns the processors of the sensor. More...
 
ProcessorBasePtrList getProcessorList ()
 Returns the processors of the sensor. More...
 
CaptureBaseConstPtr getLastCapture () const
 Returns the last capture of the sensor in the wolf tree. More...
 
CaptureBasePtr getLastCapture ()
 Returns the last capture of the sensor in the wolf tree. More...
 
void setLastCapture (CaptureBasePtr)
 Sets the last capture of the sensor in the wolf tree (more recent than the current one) More...
 
void updateLastCapture ()
 Updates the last capture, searching the most recent capture of the sensor in the trajectory. More...
 
CaptureBaseConstPtr findLastCaptureBefore (const TimeStamp &_ts) const
 Returns the most recent capture of the sensor in the trajectory not after _ts (nullptr if none) More...
 
CaptureBasePtr findLastCaptureBefore (const TimeStamp &_ts)
 Returns the most recent capture of the sensor in the trajectory not after _ts (nullptr if none) More...
 
bool process (const CaptureBasePtr capture_ptr)
 Processes a capture: sets this sensor to it and calls the captureCallback() of all processors. More...
 
StateBlockConstPtr getStateBlock (const char &_key) const override
 Returns the state block of a key: the one of the last capture containing it if dynamic, the sensor's one otherwise. More...
 
StateBlockPtr getStateBlock (const char &_key) override
 Returns the state block of a key: the one of the last capture containing it if dynamic, the sensor's one otherwise. More...
 
StateBlockConstPtr getStateBlock (const char &_key, const TimeStamp &_ts) const
 Returns the state block of a key at time stamp _ts: the one of the closest capture containing it if dynamic, the sensor's one otherwise. More...
 
StateBlockPtr getStateBlock (const char &_key, const TimeStamp &_ts)
 Returns the state block of a key at time stamp _ts: the one of the closest capture containing it if dynamic, the sensor's one otherwise. More...
 
CaptureBaseConstPtr getCaptureContainingStateBlock (const char &_key, const TimeStamp &_ts) const
 Returns the capture of the sensor closest to _ts containing the dynamic state block of a key (nullptr if none or static) More...
 
CaptureBasePtr getCaptureContainingStateBlock (const char &_key, const TimeStamp &_ts)
 Returns the capture of the sensor closest to _ts containing the dynamic state block of a key (nullptr if none or static) More...
 
CaptureBaseConstPtr getCaptureContainingStateBlock (const char &_key) const
 Returns the last capture of the sensor containing the dynamic state block of a key (nullptr if none or static) More...
 
CaptureBasePtr getCaptureContainingStateBlock (const char &_key)
 Returns the last capture of the sensor containing the dynamic state block of a key (nullptr if none or static) More...
 
StateBlockConstPtr getP (const TimeStamp _ts) const
 Returns the state block of key 'P' at time stamp _ts (see getStateBlock()) More...
 
StateBlockPtr getP (const TimeStamp _ts)
 Returns the state block of key 'P' at time stamp _ts (see getStateBlock()) More...
 
StateBlockConstPtr getO (const TimeStamp _ts) const
 Returns the state block of key 'O' at time stamp _ts (see getStateBlock()) More...
 
StateBlockPtr getO (const TimeStamp _ts)
 Returns the state block of key 'O' at time stamp _ts (see getStateBlock()) More...
 
StateBlockConstPtr getIntrinsic (const TimeStamp _ts) const
 Returns the state block of key 'I' at time stamp _ts (see getStateBlock()) More...
 
StateBlockPtr getIntrinsic (const TimeStamp _ts)
 Returns the state block of key 'I' at time stamp _ts (see getStateBlock()) More...
 
StateBlockConstPtr getP () const
 Returns the state block of key 'P' (see getStateBlock()) More...
 
StateBlockPtr getP ()
 Returns the state block of key 'P' (see getStateBlock()) More...
 
StateBlockConstPtr getO () const
 Returns the state block of key 'O' (see getStateBlock()) More...
 
StateBlockPtr getO ()
 Returns the state block of key 'O' (see getStateBlock()) More...
 
StateBlockConstPtr getIntrinsic () const
 Returns the state block of key 'I' (see getStateBlock()) More...
 
StateBlockPtr getIntrinsic ()
 Returns the state block of key 'I' (see getStateBlock()) More...
 
void setStateBlockDynamic (const char &_key, bool _dynamic=true)
 Sets whether the state block of a key is dynamic (in the captures) or static (in the sensor) More...
 
bool isStateBlockDynamic (const char &_key) const
 Returns whether the state block of a key is dynamic (in the captures) or static (in the sensor) More...
 
bool hasDrift (char _key) const
 Returns whether the drift std rate of the state of a key is specified. More...
 
void setDriftStdRate (char _key, const Eigen::VectorXd &_drift_rate_std)
 Sets the drift std rate [unit/sqrt(s)] of the dynamic state of a key. More...
 
Eigen::VectorXd getDriftStdRate (char) const
 Returns the drift std rate [unit/sqrt(s)] of the dynamic state of a key (empty if not specified) More...
 
void fixExtrinsics ()
 Fixes the extrinsics state blocks ('P' and 'O') More...
 
void unfixExtrinsics ()
 Unfixes the extrinsics state blocks ('P' and 'O') More...
 
void fixIntrinsics ()
 Fixes the intrinsics state blocks (all but 'P' and 'O') More...
 
void unfixIntrinsics ()
 Unfixes the intrinsics state blocks (all but 'P' and 'O') More...
 
bool isEnabled () const
 Returns whether the sensor is enabled (disabled sensors do not process captures) More...
 
void enable ()
 Enables the sensor. More...
 
void disable ()
 Disables the sensor. More...
 
virtual Eigen::MatrixXd computeNoiseCov (const Eigen::VectorXd &_data) const =0
 Computes the covariance of the measurement noise of some data. More...
 
virtual void printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
 Prints the information of this node (not of its children) More...
 
void printState (bool _factored_by, bool _metric, bool _state_blocks, std::ostream &_stream, std::string _tabs) const
 Prints the state blocks, indicating whether they are fixed and dynamic. More...
 
void print (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
 Prints this node and, depending on the depth, its children. More...
 
virtual CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node (not of its children) More...
 
bool check (CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Checks the consistency of this node and its children, composing the log. More...
 
void link (HardwareBasePtr)
 Links the sensor to a hardware. More...
 
SensorBasePtr shared_from_this_sensor ()
 Returns a shared pointer to this sensor. More...
 
SensorBaseConstPtr shared_from_this_sensor () const
 Returns a shared pointer to this sensor. More...
 
- Public Member Functions inherited from wolf::NodeStateBlocks
 NodeStateBlocks (const std::string &_category, const std::string &_type, const TypeComposite &_state_types, const VectorComposite &_state_vectors, const PriorComposite &_state_priors)
 Constructor. More...
 
virtual ~NodeStateBlocks ()
 Destructor. More...
 
virtual YAML::Node toYaml () const
 Returns a YAML node with the type, the states and their priors. More...
 
StateKeys getKeys () const
 Returns the keys of all the state blocks. More...
 
TypeComposite getStateTypes () const
 Returns the types of the states that the node can have. More...
 
bool has (const char &_sb_key) const
 Returns whether the node has a state block with this key. More...
 
bool has (const std::string &_keys) const
 Returns whether the node has state blocks with all these keys. More...
 
virtual unsigned int id () const =0
 Returns the id of the node, unique among the nodes of its category. More...
 
std::map< char, StateBlockConstPtr > getStateBlockMap () const
 Returns the state blocks by key. More...
 
std::map< char, StateBlockPtr > getStateBlockMap ()
 Returns the state blocks by key. More...
 
std::vector< StateBlockConstPtr > getStateBlockVec () const
 Returns the state blocks, ordered by key. More...
 
std::vector< StateBlockPtr > getStateBlockVec ()
 Returns the state blocks, ordered by key. More...
 
StateBlockConstPtr getP () const
 Returns the state block of key 'P' (nullptr if none) More...
 
StateBlockConstPtr getO () const
 Returns the state block of key 'O' (nullptr if none) More...
 
StateBlockPtr getP ()
 Returns the state block of key 'P' (nullptr if none) More...
 
StateBlockPtr getO ()
 Returns the state block of key 'O' (nullptr if none) More...
 
virtual void fix ()
 Fixes all the state blocks. More...
 
virtual void unfix ()
 Unfixes all the state blocks. More...
 
virtual bool isFixed () const
 Returns whether all the state blocks are fixed. More...
 
StateBlockPtr emplaceStateBlock (const char key, const std::string &_type, const Eigen::VectorXd &_vector, const bool &_fixed)
 Emplaces a state block. More...
 
StateBlockPtr emplaceStateBlockZero (const char key, const std::string &_type, const bool &_fixed)
 Emplaces a state block with zero state. More...
 
bool hasStateBlock (const StateBlockConstPtr &_sb) const
 Returns whether the state block belongs to this node. More...
 
bool setStateBlock (const char _sb_key, const StateBlockPtr &_sb)
 Replaces the existing state block of a key. More...
 
bool stateBlockKey (const StateBlockConstPtr &_sb, char &_key) const
 Gets the key of a state block of this node. Returns false if not found. More...
 
virtual StateBlockConstPtr getStateBlock (const char &_sb_key) const
 Returns the state block of a key (nullptr if none) More...
 
virtual StateBlockPtr getStateBlock (const char &_sb_key)
 Returns the state block of a key (nullptr if none) More...
 
void setProblem (ProblemPtr _problem) override
 Sets the problem (if not set yet) and notifies it of all the state blocks and prior factors. More...
 
virtual void remove (bool viral_remove_parent_without_children=false)
 Removes the node: its state blocks and the factors constraining them. More...
 
bool hasChildren () const override
 Returns whether the node has children in the Wolf tree. More...
 
void emplaceFactorStateBlock (const char &_key, const Eigen::VectorXd &_x, const Eigen::MatrixXd &_cov, unsigned int _start_idx=0)
 Emplaces an absolute (prior) factor on the state block of a key, or on a segment of it. More...
 
void emplacePriors ()
 Emplaces the prior factors (or fixes the states) according to the states' priors. More...
 
FactorBaseConstPtrSet getFactoredBySet () const
 Returns the factors constraining this node. More...
 
FactorBasePtrSet getFactoredBySet ()
 Returns the factors constraining this node. More...
 
void getFactoredBySet (FactorBaseConstPtrSet &_fac_set) const
 Adds the factors constraining this node to a set. More...
 
void getFactoredBySet (FactorBasePtrSet &_fac_set)
 Adds the factors constraining this node to a set. More...
 
FactorBaseConstPtrSet getSensoryFactorSet () const
 Returns the factors constraining this node that have a feature (not priors) More...
 
FactorBasePtrSet getSensoryFactorSet ()
 Returns the factors constraining this node that have a feature (not priors) More...
 
std::map< char, FactorBaseConstPtr > getPriorFactorMap () const
 Returns the prior factors by key. More...
 
std::map< char, FactorBasePtr > getPriorFactorMap ()
 Returns the prior factors by key. More...
 
FactorBaseConstPtr getPriorFactor (char) const
 Returns the prior factor of a key (nullptr if none) More...
 
FactorBasePtr getPriorFactor (char)
 Returns the prior factor of a key (nullptr if none) More...
 
FactorBaseConstPtrList getFactorsOf (ProcessorBaseConstPtr _processor_ptr, const std::string &type="") const
 Returns the factors constraining this node created by a processor (and of a type, if not empty) More...
 
FactorBasePtrList getFactorsOf (ProcessorBasePtr _processor_ptr, const std::string &type="")
 Returns the factors constraining this node created by a processor (and of a type, if not empty) More...
 
bool hasFactor (FactorBaseConstPtr _fac) const
 Returns whether the factor constrains this node. More...
 
VectorComposite getState (const StateKeys &_keys="") const
 Returns the state of the given keys (all if empty) More...
 
void setState (const VectorComposite &_state, const bool _notify=true)
 Sets the state of the keys in the composite. More...
 
void setState (const Eigen::VectorXd &_state, const StateKeys &_keys, const std::list< SizeEigen > &_sizes, const bool _notify=true)
 Sets the state of the given keys from a vector split in the given sizes. More...
 
void setState (const Eigen::VectorXd &_state, const StateKeys &_keys, const bool _notify=true)
 Sets the state of the given keys from a vector (the concatenation of their states) More...
 
void setState (const StateKeys &_keys, const std::list< Eigen::VectorXd > &_vectors, const bool _notify=true)
 Sets the state of the given keys from a list of vectors, one per key. More...
 
Eigen::VectorXd getStateVector (const StateKeys &_keys) const
 Returns the concatenation of the states of the given keys. More...
 
unsigned int getSize (const StateKeys &_keys="") const
 Returns the size of the states of the given keys (all if empty) More...
 
unsigned int getLocalSize (const StateKeys &_keys="") const
 Returns the local (tangent) size of the states of the given keys (all if empty) More...
 
bool getCovariance (const StateKeys &_keys, Eigen::MatrixXd &_cov) const
 Gets the covariance of the states of the given keys from the problem. Returns false if not available. More...
 
void perturb (double amplitude=0.01)
 Perturbs the non-fixed state blocks with random noise following a uniform distribution in [-amplitude, amplitude] (in the tangent space) More...
 
bool isCapture () const
 Returns whether the node is a capture. More...
 
bool isFrame () const
 Returns whether the node is a frame. More...
 
bool isLandmark () const
 Returns whether the node is a landmark. More...
 
bool isSensor () const
 Returns whether the node is a sensor. More...
 
- Public Member Functions inherited from wolf::NodeBase
 NodeBase (const std::string &_category, const std::string &_type="Undefined", const std::string &_name="")
 Constructor. More...
 
virtual ~NodeBase ()=default
 Destructor. More...
 
unsigned int nodeId () const
 Returns the node id, unique over the whole Wolf tree. More...
 
std::string getCategory () const
 Returns the category of the node. More...
 
std::string getType () const
 Returns the type (subcategory) of the node. More...
 
std::string getName () const
 Returns the name of the node. More...
 
bool isRemoving () const
 Returns whether the node is being removed. More...
 
virtual bool hasChildren () const =0
 Returns whether the node has children in the Wolf tree. More...
 
void setType (const std::string &_type)
 Sets the type (subcategory) of the node. More...
 
void setName (const std::string &_name)
 Sets the name of the node. More...
 
ProblemConstPtr getProblem () const
 Returns the problem the node belongs to. More...
 
ProblemPtr getProblem ()
 Returns the problem the node belongs to. More...
 

Protected Attributes

double ticks_per_wheel_revolution_
 Number of encoder ticks of a whole wheel revolution. More...
 
double ticks_std_factor_
 Ratio of the ticks noise std to the measured ticks. More...
 
- Protected Attributes inherited from wolf::SensorBase
std::map< char, Eigen::VectorXd > drifts_std_rate_
 Drift std rate of dynamic state blocks [unit/sqrt(s)]. More...
 
YAML::Node params_
 Params yaml node. More...
 
- Protected Attributes inherited from wolf::NodeBase
ProblemWPtr problem_ptr_
 Problem the node belongs to. More...
 
unsigned int node_id_
 Node id. It is unique over the whole Wolf Tree. More...
 
std::string node_category_
 Text label identifying the category of node ("SENSOR", "FEATURE", etc) More...
 
std::string node_type_
 Type or subcategory of node (derived class name: "SensorOdom2d", etc) More...
 
std::string node_name_
 
bool is_removing_
 A flag for safely removing nodes from the Wolf tree. See remove(). More...
 

Additional Inherited Members

- Protected Member Functions inherited from wolf::SensorBase
void setProblem (ProblemPtr _problem) override final
 Sets the problem to the sensor and its processors. More...
 
 SensorBase (const std::string &_type, const TypeComposite &_state_types, const YAML::Node &_params)
 Constructor. More...
 
- Protected Member Functions inherited from wolf::NodeStateBlocks
virtual void removeStateBlock (const char &_sb_key)
 Removes the state block of a key (and notifies the problem) More...
 
void transform (const VectorComposite &_transformation)
 Transforms all the state blocks (to another reference frame) More...
 
void printState (bool _factored_by, bool _metric, bool _state_blocks, std::ostream &_stream, std::string _tabs) const
 Prints the state blocks and their priors. More...
 
CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs) const
 Checks the consistency of the state blocks and the factors constraining them. More...
 
virtual void setProblem (ProblemPtr _prob_ptr)
 Sets the problem the node belongs to. More...
 

Detailed Description

Wheel encoders of a differential drive robot. Intrinsics 'I': left and right wheel radius and wheel separation.

Constructor & Destructor Documentation

◆ ~SensorDiffDrive()

wolf::SensorDiffDrive::~SensorDiffDrive ( )
overridedefault

Member Function Documentation

◆ computeNoiseCov()

Eigen::MatrixXd wolf::SensorDiffDrive::computeNoiseCov ( const Eigen::VectorXd &  _data) const
overridevirtual

Computes the covariance of the measurement noise of some data.

Implements wolf::SensorBase.

◆ getRadiansPerTick()

double wolf::SensorDiffDrive::getRadiansPerTick ( ) const
inline

Returns the wheel rotation of an encoder tick [rad].

◆ getTicksPerWheelRevolution()

double wolf::SensorDiffDrive::getTicksPerWheelRevolution ( ) const
inline

Returns the number of encoder ticks of a whole wheel revolution.

◆ getTicksStdFactor()

double wolf::SensorDiffDrive::getTicksStdFactor ( ) const
inline

Returns the ratio of the ticks noise std to the measured ticks.

◆ WOLF_SENSOR_CREATE()

wolf::SensorDiffDrive::WOLF_SENSOR_CREATE ( SensorDiffDrive  )

Member Data Documentation

◆ ticks_per_wheel_revolution_

double wolf::SensorDiffDrive::ticks_per_wheel_revolution_
protected

Number of encoder ticks of a whole wheel revolution.

◆ ticks_std_factor_

double wolf::SensorDiffDrive::ticks_std_factor_
protected

Ratio of the ticks noise std to the measured ticks.


The documentation for this class was generated from the following files: